<?php
namespace Account\Model;

use Common\Model\BaseModel;

class UserAddrModel extends BaseModel
{
    protected $_auto = [
        ['create_time', 'time', self::MODEL_INSERT, 'function'],
    ];

    protected $_validate = [

    ];

    protected $_scope = [
        'valid' => [
            'where' => ['closed' => 0],
        ],
    ];

    public function setDefault($uid, $addrid)
    {
        D('UserAddr')->where(['user_id' => $uid, 'is_default' => 1])->setField('is_default', 0);
        D('UserAddr')->where(['addr_id' => $addrid])->setField('is_default', 1);
    }



}
